import 'dart:convert' show json;
import 'package:x3_base_package/x3_base_package.dart';
import 'package:x3_business_core/common_models/base_business_model.dart';

class ClothingModel extends BaseBusinessModel {
  ClothingModel({
    this.clothingImg,
    this.clothingId,
    this.styleId,
    this.styleSKCId,
    this.styleName,
    this.brandName,
    this.colorName,
    this.sizeName,
    this.remark,
    this.priceCostNow,
    this.priceTag,
    bool check,
  }) : super(clothingId ?? styleSKCId, styleName, check: check);

  factory ClothingModel.fromJson(Map<String, dynamic> jsonRes) => jsonRes == null
      ? null
      : ClothingModel(
          clothingImg: asT<String>(jsonRes['clothingImg']),
          clothingId: asT<String>(jsonRes['clothingId']),
          styleId: asT<String>(jsonRes['styleId']),
          styleSKCId: asT<String>(jsonRes['styleSKCId']),
          styleName: asT<String>(jsonRes['styleName']),
          brandName: asT<String>(jsonRes['brandName']),
          colorName: asT<String>(jsonRes['colorName']),
          sizeName: asT<String>(jsonRes['sizeName']),
          remark: asT<String>(jsonRes['remark']),
          priceCostNow: asT<double>(jsonRes['priceCostNow']),
          priceTag: asT<double>(jsonRes['priceTag']),
          check: asT<bool>(jsonRes['check']),
        );

  String clothingImg;
  String clothingId;
  String styleId;
  String styleSKCId;
  String styleName;
  String brandName;
  String colorName;
  String sizeName;
  String remark;
  double priceCostNow;
  double priceTag;

  Map<String, dynamic> toJson() => <String, dynamic>{
        'clothingImg': clothingImg,
        'clothingId': clothingId,
        'styleId': styleId,
        'styleSKCId': styleSKCId,
        'styleName': styleName,
        'brandName': brandName,
        'colorName': colorName,
        'sizeName': sizeName,
        'remark': remark,
        'priceCostNow': priceCostNow,
        'priceTag': priceTag,
      };
  @override
  String toString() {
    return json.encode(this);
  }
}
